<template>
    <a-layout style="min-height: 100%;">
        <a-layout-sider breakpoint="md" theme="light" collapsed-width="0" @collapse="onCollapse" @breakpoint="onBreakpoint">
            <!-- :style="{ borderBottom: '1px solid ' + token.colorBorder }" -->
            <div class="logo"></div>
            <a-menu v-model:selectedKeys="selectedKeys" mode="inline">
                <a-menu-item key="1">
                    <user-outlined />
                    <span class="nav-text">nav 1</span>
                </a-menu-item>
                <a-menu-item key="2">
                    <video-camera-outlined />
                    <span class="nav-text">nav 2</span>
                </a-menu-item>
                <a-menu-item key="3">
                    <upload-outlined />
                    <span class="nav-text">nav 3</span>
                </a-menu-item>
                <a-menu-item key="4">
                    <user-outlined />
                    <span class="nav-text">nav 4</span>
                </a-menu-item>
            </a-menu>
        </a-layout-sider>
        <a-layout>
            <a-layout-header :style="{ padding: 0, backgroundColor: token.colorBgBase }">
                <div class="MainBox">
                    <div class="MainHeader">
                        <!-- <a-menu v-model:selectedKeys="selectedKeys1" mode="horizontal" :style="{ lineHeight: '64px' }">
                            <a-menu-item key="1">nav 1</a-menu-item>
                            <a-menu-item key="2">nav 2</a-menu-item>
                            <a-menu-item key="3">nav 3</a-menu-item>
                        </a-menu> -->
                    </div>
                    <div class="UserConfig">

                    </div>
                </div>
            </a-layout-header>
            <a-layout-content :style="{ margin: '16px 16px 0', }">
                <a-breadcrumb :style="{ margin: '0 0 16px 0', }">
                    <a-breadcrumb-item>Home</a-breadcrumb-item>
                    <a-breadcrumb-item>List</a-breadcrumb-item>
                    <a-breadcrumb-item>App</a-breadcrumb-item>
                </a-breadcrumb>
                <div
                    :style="{ padding: '16px', backgroundColor: token.colorBgBase, maxHeight: '100%', height: '100%', overflow: 'auto' }">
                    <RouterView>
                        <ThemeChange />
                        <br><br><br><br><br><br><br>
                        <br><br><br><br><br><br><br>
                        <br><br><br><br><br><br><br>
                        <br><br><br><br><br><br><br>
                        <br><br><br><br><br><br><br>
                        <br><br><br><br><br><br><br>
                        <br><br><br><br><br><br><br>
                        <br><br><br><br><br><br><br>
                        <button @click="Plugin('User.Logout')()" v-if="HasPlugin('User.Logout')">Logout</button>
                    </RouterView>
                </div>
            </a-layout-content>
            <a-layout-footer style="text-align: center; padding: 24px; background-color: transparent;">

            </a-layout-footer>
        </a-layout>
    </a-layout>
</template>
<script setup>
import { ref, inject } from 'vue';
import { UserOutlined, VideoCameraOutlined, UploadOutlined } from '@ant-design/icons-vue';
import { theme } from 'ant-design-vue';

const { useToken } = theme;
const { token } = useToken();

// const Plugin = inject('Plugin');
// const HasPlugin = inject('HasPlugin');


const onCollapse = (collapsed, type) => {
    console.log(collapsed, type);
};

const onBreakpoint = (broken) => {
    console.log(broken);
};
const selectedKeys1 = ref(['1'])
const selectedKeys = ref(['4']);
</script>
<style lang="less" scoped>
.MainBox {
    padding: 0 16px;
    display: flex;

    .MainHeader {
        flex-grow: 1;
    }

    .UserConfig {
        // width: 200px;
        flex: none;
    }
}

.logo {
    height: 64px;
    background: rgba(255, 255, 255, 0.2);
    padding: 16px;
    // border-bottom: 1px solid #ccc;
}

.site-layout-sub-header-background {
    background: #fff;
}

.site-layout-background {
    background: #fff;
}

[data-theme='dark'] .site-layout-sub-header-background {
    background: #141414;
}
</style>